package com.xsjiong.jaript;

public class JContext {
	private JImportHelper IHelper = new JImportHelper();
	private int VariableTableSize = 128;
	private JCompiler Compiler;
	private JExecutor Runner;
	public boolean ConstOptimize = true;
	
	public JContext() {
		Compiler = new JCompiler(this);
		Runner = new JExecutor(this);
	}

	public JImportHelper getImportHelper() {
		return IHelper;
	}

	public int getVariableTableSize() {
		return VariableTableSize;
	}

	public boolean isUsingShortVariableSize() {
		return VariableTableSize <= Short.MAX_VALUE;
	}

	public void setVariableTableSize(int variableTableSize) {
		VariableTableSize = variableTableSize;
		Compiler.setVariableTableSize(VariableTableSize);
		Runner.setVariableTableSize(VariableTableSize);
	}

	public JCompiler getCompiler() {
		return Compiler;
	}

	public JExecutor getRunner() {
		return Runner;
	}

	// TODO 完成这个方法 "evaluateString"
	public void evaluateString() {

	}
}
